<template>
  <div class="camera">
    <div id="divPlugin" class="plugin divPlugin" ref="divPlugin"></div>
    <div @click="login">开始</div>
    <div @click="logout">退出</div>
  </div>
</template>

<script setup lang="ts" name="home">
import { onMounted, nextTick } from "vue";
import { Camera } from "./index";
let camera: Camera;
const init = () => {
  console.log(camera);
  camera = new Camera({
    name: "admin",
    password: "yl521368",
    IP: "172.16.10.84",
    Port: "80",
    width: 365,
    height: 225
  });
};

const login = () => {
  camera.login();
  camera.getChannelInfo();
  camera.clickStartRealPlay();
};

const logout = () => {
  const iRet = camera.logout();
  if (iRet == 0) {
    console.log("退出");
  }
};
onMounted(() => {
  nextTick(() => {
    init();
  });
});
</script>

<style scoped lang="scss">
// yl521368
.camera {
  height: 225px;
  width: 365px;
  // border: 1px solid #ffffff;
  .divPlugin {
    width: 100%;
    height: 100%;
  }
}
</style>
